package wechat.app.util;

import com.google.common.base.Objects;
import java.io.File;
import java.io.FileInputStream;
import java.util.Properties;
import org.eclipse.xtext.xbase.lib.Exceptions;

@SuppressWarnings("all")
public class PropertyReader {
  private String confFileName = "weixin.properties";
  
  private Properties prop = null;
  
  public PropertyReader() {
    this.initProp();
  }
  
  public String getCorpId() {
    return this.prop.getProperty("CORPID");
  }
  
  public void initProp() {
    try {
      boolean _equals = Objects.equal(this.prop, null);
      if (_equals) {
        final String filePath = PropertyReader.class.getClassLoader().getResource(this.confFileName).getPath();
        Properties _properties = new Properties();
        this.prop = _properties;
        File _file = new File(filePath);
        FileInputStream _fileInputStream = new FileInputStream(_file);
        this.prop.load(_fileInputStream);
      }
    } catch (Throwable _e) {
      throw Exceptions.sneakyThrow(_e);
    }
  }
  
  public String getSECRET() {
    return this.prop.getProperty("SECRET");
  }
  
  public String getAGENTID() {
    return this.prop.getProperty("AGENTID");
  }
}
